#

| Chapter 1 |

# 1. Introduction

Contents:
What's Special About UNIX?
Who Listens to What You Type?
Programs Are Designed to Work Together
Using Pipes to Create a New Tool
Anyone Can Program the Shell
Power Tools for Editing
Power Grows on You
There Are Many Shells
Which Shell Am I Running?
Internal and External Commands
How the Shell Executes Other Commands
What Makes a Shell Script?
Why Fundamentals Are Important
The Kernel and Daemons
Filenames
Wildcards
Filename Extensions
Who Handles Wildcards?
The Tree Structure of the Filesystem
Your Home Directory
Making Pathnames
How UNIX Keeps Track of Files: Inodes
File Access Permissions
The Superuser (Root)
Access to Directories
What a Multiuser System Can Do for You
How Background Processing Works
Some Gotchas with Background Processing
When Is a File Not a File?
Redirecting Input and Output
The X Window System
One Big Hole
UNIX Networking and Communications
What's Wrong with UNIX

## 1.1 What's Special About UNIX?

If we were writing about any other operating system, "power tools" might mean "nifty add-on utilities to extend the power of your operating system."

That sounds suspiciously like a definition of UNIX: an operating system loaded with 25 years' worth of nifty add-on utilities.

UNIX is unique in that it wasn't designed as a commercial operating system meant to run application programs, but as a hacker's toolset, by and for programmers. In fact, an early release of the operating system went by the name PWB (Programmer's Work Bench).

When Ken Thompson and Dennis Ritchie first wrote UNIX at AT&T Bell Labs, it was for their own use, and for their friends and co-workers. Utility programs were added by various people as they had problems to solve. Because Bell Labs wasn't in the computer business, source code was given out to universities for a nominal fee. Brilliant researchers wrote their own software and added it to UNIX in a spree of creative anarchy that hasn't been equaled since, except perhaps in the introduction of the X Window System (1.31).

Unlike most other operating systems, where free software remains an unsupported add-on, UNIX has taken as its own the work of thousands of independent programmers. During the commercialization of UNIX within the past ten years, this incorporation of outside software has slowed down, but not stopped entirely, especially in the university environment.

A book on UNIX Power Tools® therefore inevitably has to focus not just on add-on utilities (though we do include many of those) but on how to use clever features of the many utilities that have been made part of UNIX over the years.

UNIX is also important to power users because it's one of the last popular operating systems that doesn't force you to work behind an interface of menus and windows and a mouse with a "one-size(-doesn't)-fit-all" programming interface. Yes, you can use UNIX interfaces with windows and menus - and they can be great time savers in a lot of cases. But UNIX also gives you building blocks that, with some training and practice, will give you many more choices than any software designer can cram onto a set of menus. If you learn to use UNIX and its utilities from the command line, you don't have to be a programmer to do very powerful things with a few keystrokes.

So, it's also essential that this book teach you some of the underlying principles that make UNIX such a tinkerer's paradise.

In the body of this book, we assume that you are already moderately familiar with UNIX-a journeyman hacker wanting to become a master. But at the same time, we don't want to leave beginners entirely at sea, so in this chapter, we include some fundamental concepts. We've tried to intersperse some simple tips and tricks to keep things interesting, but the ratio of concept articles to tips is much higher than in any other part of the book. The concepts covered are also much more basic. If you aren't a beginner, you can safely skip this chapter, though we may bounce you back here if you don't understand something later in the book.

Don't expect a complete introduction to UNIX-if you need that, buy an introductory book. What you'll find here is a selection of key concepts that you'll need to understand to progress beyond the beginner stage, and answers to frequently asked questions and problems. In some ways, consider this introduction a teaser. If you are a beginner, we want to show you enough of UNIX to whet your appetite for more.

Also, don't expect everything to be in order. Because we don't want you to get in the habit of reading through each chapter from beginning to end, as in most books, the articles in this chapter are in loose order. We've tried not to make you jump around too much, but we've also avoided a lot of the transitional material that makes reading most books a chore.

- TOR, JP

Acknowledgments for the Second Edition |  | 1.2 Who Listens to What You Type?